package com.itheima.Controller;

import com.itheima.Service.SetMealService;
import com.itheima.common.entity.Result;
import com.itheima.pojo.Setmeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("setmeal")
public class SetMealController {
    @Autowired
    private SetMealService setMealService;
    
    //获取所有套餐信息
    @PostMapping("getSetmeal")
    public Result  getSetmeal(){
        List<Setmeal>result=setMealService.getSetmeal();
        return new Result(true,"获取所有套餐信息成功",result);
    }

    //根据套餐id查询套餐详情
    @PostMapping("findById")
    public Result findById(Integer id){
        Setmeal result=setMealService.findById(id);
        return new Result(true,"根据套餐id查询套餐详情成功",result);
    }
}
